package map


type Vertex struct {
	X float64
	Y float64
}


func mapVertex() {
	var m map[string]Vertex
	m = make(map[string]Vertex)
	m["Bell Labs"] = Vertex{
		40, 50,
	}
	fmt.Println(m["Bell Labs"])

	var m2 = map[string]Vertex{
		"Bell Labs": {
			40, 50,
		},
		"Google": {
			2, 3,
		},
	}

	fmt.Println(m2)

	var m3 = map[string]Vertex{
		"Bell Labs": {40, 50},
		"Google":    {2, 3},
	}
	fmt.Println(m3)
}

func mapChange() {
	m := make(map[string]int)

	m["答案"] = 42
	fmt.Println("值：", m["答案"])

	m["答案"] = 48
	fmt.Println("值：", m["答案"])
	fmt.Println(m)

	delete(m, "答案")
	fmt.Println("值：", m["答案"])

	fmt.Println(m)

	elem, ok := m["答案"]
	fmt.Println("值：", elem, "是否存在？", ok)
}
